package com.csair.common.utils;

import android.util.Log;

import com.csair.common.AppUtilsConfig;


public final class LogUtils {

    private static final String TAG = "CSMBP-";
    private static final int PARTLENGTH = 3000;

    public static void e(String tag, String msg) {
        if (!AppUtilsConfig.getIsDebugMode()) return;
        tag = tag != null ? TAG + tag : TAG;
        if (msg != null && msg.length() > PARTLENGTH) {
            e(tag, msg.substring(0, PARTLENGTH));
            e(tag, msg.substring(PARTLENGTH));
        } else
            Log.e(tag, msg != null ? msg : "");
    }

    public static void i(String tag, String msg) {
        if (!AppUtilsConfig.getIsDebugMode()) return;
        tag = tag != null ? TAG + tag : TAG;
        Log.i(tag, msg != null ? msg : "");
    }

    public static void v(String tag, String msg) {
        if (!AppUtilsConfig.getIsDebugMode()) return;
        tag = tag != null ? TAG + tag : TAG;
        Log.i(tag, msg != null ? msg : "");
    }

    public static void printStackTrace(Throwable e) {
        if (AppUtilsConfig.getIsDebugMode()) e.printStackTrace();
    }




}
